package com.auotc.tabhostdemo;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by lgs on 2019/4/11.
 */
public class HomeFragment extends Fragment implements View.OnClickListener {

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_home, null);
        view.findViewById(R.id.tv_home).setOnClickListener(this);
        return view;
    }

    @Override
    public void onResume() {
        super.onResume();
        MyLog.i("HomeFragment onResume");
    }

    @Override
    public void onPause() {
        super.onPause();
        MyLog.i("HomeFragment onPause");
    }

    @Override
    public void onClick(View v) {
        startActivityForResult(new Intent(getContext(), TwoActivity.class), 21);
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        MyLog.i("onActivityResult" + ", requestCode = " + requestCode + ", resultCode = " + resultCode + ", data = " + data.getStringExtra("two"));
    }
}
